package com.xiaoq.shop.repository.impl;

import com.xiaoq.shop.entity.CatalogEntity;
import com.xiaoq.shop.repository.ICatalogRepository;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * Created by chenjh on 2017/11/3.
 */
@Repository
public class CatalogRepositoryImpl implements ICatalogRepository {

    @Autowired
    private Datastore dataStore;

    /**
     * 取门票信息， catalogCode 为 0
     * @return
     */
    @Override
    public CatalogEntity getTicketCatalogList() {
        Query<CatalogEntity> catalogEntityQuery = dataStore.find(CatalogEntity.class)
                .field("catalogCode").equal("0");
        return catalogEntityQuery.get();
    }
}
